steam_ugc_request_item_details

语法:

steam_ugc_request_item_details(published_file_id, max_age_seconds);


参数 描述
published_file_id The unique file ID for the UGC to be checked.
max_age_seconds The "age" of the data to check (recommended 30 - 60 seconds).


Returns: Async ID


描述

This function can be used to retrieve information about a given file ID. You give the file ID and supply a maximum age for checking (see the Steam docs for more information), then the function returns a unique async ID value which can be used to check the details correctly in the Steam Async event. This event will have the async_load DS map which will be populated with the following key/value pairs:

  1. "id" - 触发事件的函数返回的异步 ID

  2. "result" - 操作的结果(实际值)。这将是 GML 常量 ugc_result_success 或其他一些实数。So you should check for this constant to ensure that the call was successful, and if otherwise somthing has not worked correctly. 返回的其余可能值显示为 Steam “EResult” 值的结果,你应该在 SDK 头文件 steamclientpublic.h 中看到所有 89 个可能值。

  3. "event_type" - The string "ugc_item_details"

  4. "cached_data" - Will be true if the returned details are from the local cache or false if they are taken from the server

  5. "published_file_id"" -Holds the unique published file id for the item

  6. "file_type" - The type of file used

  7. "creator_app_id" - The Steam ID of the item creator

  8. "consumer_app_id" - The Steam ID of the item consumer

  9. "title" - The title of the item

  10. "description" - The description of the item

  11. "steam_id_owner" - The Steam ID of the item owner

  12. "time_created" - The time the item was first created

  13. "time_updated" - The last time the item was updated

  14. "time_added_to_user_list" - The time that the item was subscribed to

  15. "visibility" - The visibility of the item (see steam_ugc_set_item_visibility() for the returned constants)

  16. "banned" - Whether the item has been banned (true) or not (false)

  17. "accepted_for_use" - Whether the item has been accepted for use (true) or not (false)

  18. "tags_truncated" - Short version of the tags as an array

  19. "tags" - An array of the tags for the item

  20. "handle_file" - The unique file handle for the item

  21. "handle_preview_file" - The unique handle for the image preview for the item (can be used as an argument with steam_ugc_download() to download a preview image)

  22. "filename" - The name of the item file

  23. "file_size" - The size of the item file

  24. "preview_file_size" - The size of the preview image

  25. "url" - The full URL for the item

  26. "votes_up" - The number of up-votes received

  27. "votes_down" - The number of down-votes received

  28. "score" - The overall score of the item

  29. "account_id_owner" - The account ID from the Steam ID owner (this can be used in the function steam_ugc_create_query_user_ex())


Extended 举例:

In this example we send off a details request for an item and then parse the resulting async_load DS map to set some variables. First we send of the request:

steam_details = steam_ugc_request_item_details(global.fileID, 60);

The above code will request details on the item with the file ID stored in the global variable and will trigger a Steam Async event with the returned information. In this event we can then parse the map and store some of the values in variables which can then be used to display the information to the user:

var map_id = async_load[?"id"];
var result = async_load[?"result"];
if (map_id == steam_details) && (result == ugc_result_success)
   {
   mTitle = async_load[?"title"];
   mDesc = async_load[?"description"];
   mTags = async_load[?"tags"];
   m_hPreviewFile = async_load[?"handle_preview_file"];
   m_hOwnerSteamId = async_load[?"steam_id_owner"];
   mOwnerAccountId = async_load[?"account_id_owner"];
   mPubFileId = async_load[?"published_file_id"];
   mScore = async_load[?"score"];
   }